{% extends 'base.html' %}

{% block extra_css %}
<link rel="stylesheet" href="/static/css/grades.css">
{% endblock %}

{% block content %}
<div class="form-container">
    <h1 class="page-title">
        <i class="fas fa-school"></i>
        {% if form.instance.pk %}编辑班级{% else %}创建新班级{% endif %}
    </h1>
    
    <form method="post" class="grade-form">
        {% csrf_token %}
        
        <div class="form-group">
            <label for="{{ form.name.id_for_label }}">
                <i class="fas fa-tag"></i> 班级名称：
            </label>
            {{ form.name }}
            <div class="form-hint">请输入班级名称，如：一年级一班</div>
            {% if form.name.errors %}
                <div class="error-message">{{ form.name.errors }}</div>
            {% endif %}
        </div>
        
        <div class="form-group">
            <label for="{{ form.description.id_for_label }}">
                <i class="fas fa-align-left"></i> 班级描述：
            </label>
            {{ form.description }}
            <div class="form-hint">请输入班级的详细描述信息（可选）</div>
            {% if form.description.errors %}
                <div class="error-message">{{ form.description.errors }}</div>
            {% endif %}
        </div>
        
        <div class="form-actions">
            <button type="submit" class="btn-primary">
                <i class="fas fa-save"></i> {% if form.instance.pk %}更新班级{% else %}创建班级{% endif %}
            </button>
            <a href="{% url 'grades:grade_list' %}" class="btn-secondary">
                <i class="fas fa-times"></i> 取消
            </a>
        </div>
    </form>
</div>
{% endblock %}